package com.wj.tool.common.utils;

public class BookUtils {

    // 通过类型名获取code
    public static int getTypeByName(String typeName){
        if (StringUtils.isBlank(typeName)){
            return 0;
        }
        if (typeName.contains("都市")){
            return 1;
        } else if (typeName.contains("玄幻")){
            return 2;
        } else if (typeName.contains("修真")){
            return 3;
        } else if (typeName.contains("科幻")){
            return 4;
        } else if (typeName.contains("网游")){
            return 5;
        } else if (typeName.contains("历史")){
            return 6;
        } else {
            return 7;
        }
    }

    public static String getTypeNameByCode(int typeCode){
        if (typeCode == 1){
            return "都市小说";
        } else if (typeCode == 2){
            return "玄幻小说";
        } else if (typeCode == 3){
            return "修真小说";
        } else if (typeCode == 4){
            return "科幻小说";
        } else if (typeCode == 5){
            return "网游小说";
        } else if (typeCode == 6){
            return "历史小说";
        } else {
            return "其他小说";
        }
    }
}